import com.atguigu.gmall.realtime.bean.VisitorStats;

import java.lang.reflect.Field;

/**
 * @Author lzc
 * @Date 2022/3/25 14:21
 */
public class Demo3 {
    public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException {
        Class<VisitorStats> tClass = VisitorStats.class;
    
    
        /*Field[] fields = tClass.getDeclaredFields();
        for (Field field : fields) {
            System.out.println(field.getName());
        }*/
    
        VisitorStats t = new VisitorStats();
        t.setStt("2022-03-25");
        
        // 获取stt的属性
        Field stt = tClass.getDeclaredField("stt");
        stt.setAccessible(true);  // 允许通过反射的方式获取私有属性的值
//        Object s = stt.get(t);
        stt.set(t, "abc");
        System.out.println(t);
    
    
    }
}
